<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <title>Wechat login demo</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
    <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
</head>
<body>
<style>

</style>

<a href="javascript:;" onClick="goWxLogin()">微信登录</a>
<!-- <a href="https://open.weixin.qq.com/connect/qrconnect?appid=wxb86549d2232fa48d&redirect_uri=http%3A%2F%2F127.0.0.1%2Fapi%2Fwechat%2Foauth&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect">跳转微信登录</a> -->
<div id="login_container"></div>
<script>
  function goWxLogin() {
    // var obj = new WxLogin({
    //   id: "login_container",
    //   appid: "wxb86549d2232fa48d",
    //   scope: "snsapi_base",
    //   redirect_uri: encodeURIComponent("http://127.0.0.1/api/wechat/oauth"),
    //   state: "",
    //   style: "",
    //   href: ""
    // })
    var appId = "wxb86549d2232fa48d";
    var redirectUri = encodeURI("http://192.168.101.63:7070/wechat/index.html");
    var scope = "snsapi_base";
    let authUrl = `https://open.weixin.qq.com/connect/qrconnect?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=${scope}&state=1#wechat_redirect`;
    let authUrl2 = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=${scope}&state=1#wechat_redirect`
    window.location.href = authUrl2;
  }

</script>
</body>
</html>
